package com.yanqu.road.entity.activity.snowgarden.config;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.HashMap;
import java.util.Map;

@FieldTypeAnnotation(tableName = "t_s_activity_snowgarden_buy")
public class SnowGardenBuyConfig extends DataObject {

    @FieldTypeAnnotation(desc = "活动id", select = true, isIndex = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "对应mall表的extendParam", isIndex = true, orderASC = true)
    private int id;
    @FieldTypeAnnotation(desc = "目标人数")
    private String targetPeople;
    @FieldTypeAnnotation(desc = "间隔多少秒检查目标人数")
    private long judgeTime;
    @FieldTypeAnnotation(desc = "每多少秒加一次假进度")
    private long intervalTime;

    //8,12,1|16,24,2|24,36,3|32,48,4|40,60,5|48,72,6|56,84,7|64,96,8|72,108,9|80,120,10|88,132,11|96,144,12|104,156,13|112,168,14|120,180,15|128,192,16|136,204,17|144,216,18|152,228,19|160,240,20|168,252,21|176,264,22|184,276,23
    //key:每天的第N个小时
    private Map<Integer, SnowGardenFakeBuyInfo> fakeBuyInfoMap = new HashMap<>();

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTargetPeople() {
        return targetPeople;
    }

    public void setTargetPeople(String targetPeople) {
        this.targetPeople = targetPeople;
        Map<Integer, SnowGardenFakeBuyInfo> tempInfoMap = new HashMap<>();
        String[] split = targetPeople.split("\\|");
        for (int i = 0; i < split.length; i++) {
            String params = split[i];
            int keyNumber = i + 1;
            SnowGardenFakeBuyInfo fakeBuyInfo = new SnowGardenFakeBuyInfo(keyNumber, params);
            tempInfoMap.put(fakeBuyInfo.getHourNumber(), fakeBuyInfo);
        }
        this.fakeBuyInfoMap = tempInfoMap;
    }

    public Map<Integer, SnowGardenFakeBuyInfo> getFakeBuyInfoMap() {
        return fakeBuyInfoMap;
    }

    public SnowGardenFakeBuyInfo getFakeBuyInfo(int hourNum){
        return fakeBuyInfoMap.get(hourNum);
    }

    public long getJudgeTime() {
        return judgeTime;
    }

    public void setJudgeTime(long judgeTime) {
        this.judgeTime = judgeTime;
    }

    public long getIntervalTime() {
        return intervalTime;
    }

    public void setIntervalTime(long intervalTime) {
        this.intervalTime = intervalTime;
    }
}
